package com.jzo2o.customer.controller.agency;

import com.jzo2o.customer.model.dto.request.AgencyCertificationAuditAddReqDTO;
import com.jzo2o.customer.model.dto.response.RejectReasonResDTO;
import com.jzo2o.customer.service.IAgencyCertificationAuditService;
import com.jzo2o.customer.service.IAgencyCertificationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 机构端 - 认证审核
 */
@RestController("agencyCertificationAuditController")
@RequestMapping("/agency/agency-certification-audit")
@Api(tags = "机构端 - 认证审核")
public class CertificationAuditController {
    @Resource
    private IAgencyCertificationService agencyCertificationService; // 机构认证服务
    @Resource
    private IAgencyCertificationAuditService agencyCertificationAuditService;

    /**
     * 机构端 - 提交认证申请
     *
     * @param agencyCertificationAuditAddReqDTO 机构认证申请模型
     */
    @PostMapping
    @ApiOperation("机构端 - 提交认证申请")
    public void addCertificationInfo(@RequestBody AgencyCertificationAuditAddReqDTO agencyCertificationAuditAddReqDTO) {
        agencyCertificationService.addCertificationInfoForAgency(agencyCertificationAuditAddReqDTO);
    }

    /**
     * 机构端 - 查询最新驳回原因
     */
    @GetMapping("/rejectReason")
    @ApiOperation("查询最新驳回原因")
    public RejectReasonResDTO getLatestRejectReason() {
        return agencyCertificationAuditService.getLatestRejectReason();
    }

}
